/**
 * 教员评分统计---教员评分明细
 */
<template>
  <vp-dialog ref="editDialogRef" :span="2">
        <template #title>
            <vp-label zh="教员评分明细" en="Teacher Eval. Detail"/>
        </template>
        <vp-card>
            <vp-vxe-table
				id="statisticsDetailDialogTable"
				:data="tableData" 
				row-key="id"
				v-loading="loading"
			>	
				<vxe-column field="seq" type="seq" align="center" title="#" width="50" />
				<vxe-column 
					field="dabh" 
					title="教员 Trainer"
					show-overflow 
					width="140"
				>
					<template #header><vp-label zh="教员" en="Trainer" /></template>
				</vxe-column>
				<vxe-column 
					field="xfsj" 
					title="下发评分日期 Issue Scoring Date"
					show-overflow
					width="160"
				>
					<template #header><vp-label zh="下发评分日期" en="Issue Eval Date" /></template>
				</vxe-column>
				<vxe-column 
					field="df" 
					title="总分（平均分） Total Score (Average)"
					show-overflow
					width="180"
				>
					<template #header><vp-label zh="总分（平均分）" en="Total Score (Average)" /></template>
                    <template #default="{ row }">
						<el-link @click="handleViewTrainingTeacherEval(row.id)">{{ row.df }}</el-link>
					</template>
				</vxe-column>
				<vxe-column 
					field="pfry" 
					title="评分人员 Course Name"
					show-overflow 
					min-width="250"
				>
					<template #header><vp-label zh="评分人员" en="Course Name" /></template>
				</vxe-column>
				<vxe-column 
					field="sjks" 
					title="涉及课程/说明 Course Desc"
					show-overflow 
					min-width="250"
				>
					<template #header><vp-label zh="涉及课程/说明" en="Course Desc" /></template>
					<template #default="{ row }">
						<el-link @click="handleViewTrainingPlan(row.pxid)">
							{{ (row.sjKsrq || '') + ' ' + (row.kcmcZw || '') + ' ' + 
                        	(row.kcmcYw || '') +  ' ' + (row.pxbh || '') + ' ' + (row.fbt || '')}}
						</el-link>
					</template>
				</vxe-column>
			</vp-vxe-table>
        </vp-card>
  </vp-dialog>
</template>

<script setup lang="ts" name="statisticsDetailDialog">
import { ref } from 'vue';
import request from '/@/utils/request';
import { useRouter } from 'vue-router';

const searchForm = ref({
    jydaid: "",
    xfsj: []
});


const tableData = ref([]);
const loading = ref(false);

const editDialogRef = ref();


const handleOpen = (param: any)=>{
    editDialogRef.value.handleOpen();
    searchForm.value.jydaid = param.jydaid;
    searchForm.value.xfsj = param.xfsj;
    loadDataList();
}

const loadDataList = () => {
    loading.value = true;
    request.get('/training/teacherEvalStatistics/detail/list', {
        params: {
            ...searchForm.value,
            total: 0, // 总条数
            pageNum: 1, // 当前页
            pageSize: 999, // 分页大小
            sortColumn: "",
            sortOrder: ""
        }
    }).then(res => {
        tableData.value = res?.data?.list || [];
    }).finally(()=>{
        loading.value = false;
    })
}

// 查看教员评分
const router = useRouter();
const handleViewTrainingTeacherEval = (id: string) => {
	router.push({
		name: "viewTrainingTeacherEval",
		params: {
			id: id,
		},
	})
}

// 查看培训计划
const handleViewTrainingPlan = (id: string)=>{
	router.push({
		name: "viewTrainingPlan",
		params: {
			id: id,
		},
	})
}

defineExpose({
    handleOpen
})
</script>
